/*
 * @Author: hongbin
 * @Date: 2022-11-03 17:45:57
 * @LastEditors: hongbin
 * @LastEditTime: 2022-11-03 17:45:58
 * @Description:加密函数
 */
const JSEncrypt = require("node-jsencrypt");
//TODO 密钥放到环境变量中
const key = require("../key/key");

const encryptInstance = new JSEncrypt();
encryptInstance.setPrivateKey(key.priv);
//加密
export const encrypt = (data: string) => encryptInstance.encrypt(data);
//解密
export const decrypt = (data: string) => encryptInstance.decrypt(data);
